*****************************************************************************************************************************************************
* PROJECT: 		Exposure to the COVID-19 Stock Market Crash and its Effect on Household Expectations
* DATE: 		Nov 2020
* CONTENT: 		FIGURES
* AUTHORS: 		Tobin Hanspal, Johannes Wohlfart, Anni Weber
*****************************************************************************************************************************************************

		clear all
		set scheme lean2
		global pm = char(177)
		set more off
		gl date = c(current_date)
		graph set window fontface "cmr10"
		
		
* set cd as /Replication_files_HanspalWeberWohlfart2020/

*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~						
** FIGURE A18
*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~	

use data/processed/data_1, clear

* Scale USD variables	
	foreach x in  delofin_USD_tr02 delretir_USD_tr02  delfinwealth_USD_tr02  delofin_USD_tr02alt delretir_USD_tr02alt  delfinwealth_USD_tr02alt  {
		replace `x' = `x'/1000
	}
	foreach x in ofinwealth_lvl retirewealth_lvl  finwealth_Jan20 hhinc_lvl hhnetinc_2019   {
		replace `x' = `x'/1000
	}

	* fin wealth by netwealth
	graph bar (mean)  ofinwealth_lvl retirewealth_lvl  finwealth_Jan20  , ///
			over(netwealth_Jan20_grp, relabel(1 1 2 2 3 3 4 4 5 5)) b1title() ///
			  bargap(0)  /// 
			ytitle("Total financial wealth ($1000)", size(medsmall)) ///
			yline(0, lcolor(gs8) lpattern(dash)) graphregion(color(white)) bgcolor(white) ///
			ylabel(, nogrid)  legend(size(small) symxsize(3) symysize(3) pos(6) ring(1) cols(6) ///
			label(1 "Other financial wealth") label(2 "Retirement wealth") ///
			label(3 "Total financial wealth")) saving(Figures/temp1.gph, replace)
		
	* fin wealth by Age	
	graph bar (mean)  ofinwealth_lvl retirewealth_lvl  finwealth_Jan20  , ///
			over(agecat, relabel(1 "18-24" 2 "25-34" 3 "35-44" 4 "45-54" 5 "55-64" 6 "65+") label(labsize(small))) b1title() ///
			  bargap(0)  /// 
				ytitle("") ///
			yline(0, lcolor(gs8) lpattern(dash)) graphregion(color(white)) bgcolor(white) ///
			ylabel(, nogrid)  legend(size(small) pos(6) ring(1) cols(6) ///
			label(1 "Other financial wealth") label(2 "Retirement wealth") ///
			label(3 "Total financial wealth")) 	saving(Figures/temp2.gph, replace)	
		
	* fin wealth by Netincome
	graph bar (mean)  ofinwealth_lvl retirewealth_lvl  finwealth_Jan20  , ///
			over(hhnetinc_2019_grp) b1title() ///
			  bargap(0)  /// 
			ytitle("") ///
			yline(0, lcolor(gs8) lpattern(dash)) graphregion(color(white)) bgcolor(white) ///
			ylabel(, nogrid)  legend(size(vsmall) pos(6) ring(1) cols(6) ///
			label(1 "Other financial wealth") label(2 "Retirement wealth") ///
			label(3 "Total financial wealth")) saving(Figures/temp3.gph, replace)
		
		
	* net Income 2020 by netwealth
	graph bar (mean)  hhnetinc_2019  , ///
			over(netwealth_Jan20_grp, relabel(1 1 2 2 3 3 4 4 5 5)) b1title(Net wealth quintile, size(medsmall)) ///
			  bargap(0)  /// 
			ytitle("Household net income ($1000)", size(medsmall)) ///
			yline(0, lcolor(gs8) lpattern(dash)) graphregion(color(white)) bgcolor(white) ///
			ylabel(, nogrid)  legend(size(small) pos(6) ring(1) cols(6) ///
			label(1 "Other financial wealth") label(2 "Retirement wealth") ///
			label(3 "Total financial wealth")) saving(Figures/temp4.gph, replace)
	
	* net Income 2020 by Age	
	graph bar (mean)  hhnetinc_2019  , ///
			over(agecat, relabel(1 "18-24" 2 "25-34" 3 "35-44" 4 "45-54" 5 "55-64" 6 "65+") label(labsize(small))) b1title(Age group, size(medsmall)) ///
			  bargap(0)  /// 
				ytitle("") ///
			yline(0, lcolor(gs8) lpattern(dash)) graphregion(color(white)) bgcolor(white) ///
			ylabel(, nogrid)  legend(size(small) pos(6) ring(1) cols(6) ///
			label(1 "Other financial wealth") label(2 "Retirement wealth") ///
			label(3 "Total financial wealth")) 	saving(Figures/temp5.gph, replace)	
	
	* net Income 2020 by Netincome
	graph bar (mean) hhnetinc_2019 , ///
			over(hhnetinc_2019_grp) b1title(Net income quintile, size(medsmall)) ///
			  bargap(0)  /// 
			ytitle("") ///
			yline(0, lcolor(gs8) lpattern(dash)) graphregion(color(white)) bgcolor(white) ///
			ylabel(, nogrid)  legend(size(small) pos(6) ring(1) cols(6) ///
			label(1 "Other financial wealth") label(2 "Retirement wealth") ///
			label(3 "Total financial wealth")) saving(Figures/temp6.gph, replace)
		
	grc1leg2 		Figures/temp1.gph ///
					Figures/temp3.gph ///
					Figures/temp2.gph ///
					Figures/temp4.gph ///
					Figures/temp6.gph ///
					Figures/temp5.gph, cols(3) ysize(2) xsize(3) ///
					ring(0) pos(0) holes(7) legendfrom(Figures/temp1.gph) lsize(vsmall)

	graph export Figures/FigureA18.pdf, as(pdf)  fontface("cmr10") replace	
	graph export Figures/FigureA18.png, width(1600) replace 

forvalues x = 1/6 {
		capture erase Figures/temp`x'.gph
}					
